<html lang="java">
<head>
    <title>123</title>
    <script type="text/javascript" src="/static/js/form-check.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            var submit = document.getElementById("submit");

            var cName = document.getElementById("cName");
            var scName = document.getElementById("scName");
            cName.onblur = checkcName;

            function checkcName() {
                return check(cName, scName, "公司名称");
            }

            var cAddress = document.getElementById("cAddress");
            var scAddress = document.getElementById("scAddress");
            cAddress.onblur = checkcAddress;

            function checkcAddress() {
                return check(cAddress, scAddress, "公司地址");
            }

            var cCount = document.getElementById("cCount");
            var scCount = document.getElementById("scCount");
            cCount.onblur = checkcCounts;

            function checkcCounts() {

                return checkNumberMtZero(cCount, scCount) && check(cCount, scCount, "员工数");
            }

            var cHead = document.getElementById("cHead");
            var scHead = document.getElementById("scHead");
            cHead.onblur = checkcHead;

            function checkcHead() {
                return check(cHead, scHead, "负责人");
            }

            var cIdcard = document.getElementById("cIdcard");
            var scIdcard = document.getElementById("scIdcard");
            cIdcard.onblur = checkcIdcard;

            function checkcIdcard() {

                return checkNumberMtZero(cIdcard, scIdcard) && check(cIdcard, scIdcard, "身份证号");
            }

            var cTel = document.getElementById("cTel");
            var scTel = document.getElementById("scTel");
            cTel.onblur = checkcTel;

            function checkcTel() {
                return checkNumberMtZero(cTel, scTel) && check(cTel, scTel, "联系电话");
            }

            var cEmail = document.getElementById("cEmail");
            var scEmail = document.getElementById("scEmail");
            cEmail.onblur = checkcEmail;

            function checkcEmail() {
                return check(cEmail, scEmail, "公司邮箱");
            }

            var cWeixin = document.getElementById("cWeixin");
            var scWeixin = document.getElementById("scWeixin");
            cWeixin.onblur = checkcWeixin;

            function checkcWeixin() {
                return check(cWeixin, scWeixin, "微信");
            }

            var cRemarks = document.getElementById("cRemarks");
            var scRemarks = document.getElementById("scRemarks");
            cRemarks.onblur = checkcRemarks;

            function checkcRemarks() {
                return check(cRemarks, scRemarks, "备注");
            }

            function check(view, s, text) {
                var value = view.value;
                if (value == null || value == "") {
                    s.innerHTML = text + "不能为空";
                    view.focus();
                    return false;
                } else {
                    s.innerHTML = "";
                    return true;
                }
            }

            submit.onclick = function () {
                if (checkcName() && checkcAddress() && checkcCounts() && checkcHead()
                    && checkcIdcard() && checkcTel() && checkcEmail() && checkcWeixin() && checkcRemarks()) {
                    return true;
                }
                return false;
            }
        }
    </script>
    <style type="text/css">
        span {
            color: red;
        }

        body {
            background-size: 100% 100%;
            height: 100%;
            width: 100%;
            text-align: center;
            margin-top: 50px;
            margin-left: auto;
        }

        table {
            text-align: center;
            margin: auto;
            text-decoration-color: #E3E6EB;
        }

        h1 {
            font-size: 35px;
            color: #5d5a8b;
        }
    </style>
</head>
<body background="/static/img/Q1.jpg">
<h1>添加公司信息</h1>
<form action="/record/insertCom.do" method="post">
    <table cellpadding="4" cellspacing="1">
        <tr>
            <td>公司名称：</td>
            <td><input type="text" placeholder="天津大宇宙" name="cName" id="cName"/><span id="scName"></span></td>
        </tr>
        <tr>
            <td>公司地址：</td>
            <td><input type="text" value="" name="cAddress" id="cAddress"/><span id="scAddress"></span></td>
        </tr>
        <tr>
            <td>员工数：</td>
            <td><input type="text" value="" name="cCount" id="cCount"/><span id="scCount"></span></td>
        </tr>
        <tr>
            <td>负责人：</td>
            <td><input type="text" value="" name="cHead" id="cHead"/><span id="scHead"></span></td>
        </tr>
        <tr>
            <td>身份证号：</td>
            <td><input type="text" value="" name="cIdcard" id="cIdcard"/><span id="scIdcard"></span></td>
        </tr>
        <tr>
            <td>联系电话：</td>
            <td><input type="text" value="" name="cTel" id="cTel"/><span id="scTel"></span></td>
        </tr>
        <tr>
            <td>公司邮箱：</td>
            <td><input type="text" value="" name="cEmail" id="cEmail"/><span id="scEmail"></span></td>
        </tr>
        <tr>
            <td>微信：</td>
            <td><input type="text" value="" name="cWeixin" id="cWeixin"/><span id="scWeixin"></span></td>
        </tr>
        <tr>
            <td>备注：</td>
            <td><textarea name="cRemarks" id="cRemarks"></textarea><span id="scRemarks"></span></td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center"><input type="submit" value="添加" id="submit"></td>
        </tr>
    </table>
</form>

</body>
</html>